package com.ioc.business.base.controller;


import com.ioc.business.base.domain.bo.customer.CustomerInfoBo;
import com.ioc.business.base.service.ICustomerInfoService;
import com.ioc.business.base.vo.customer.info.CustomerInfoItemVo;
import com.ioc.common.core.controller.BaseController;
import com.ioc.common.core.domain.AjaxResult;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 客户信息表 前端控制器
 * </p>
 *
 * @author WeiZhongRong
 * @since 2025-01-09
 */
@RestController
@RequestMapping("/customer-info")
@AllArgsConstructor
public class CustomerInfoController extends BaseController {

    private final ICustomerInfoService customerInfoService;

    /**
     * 查询客户信息列表
     *
     * @return
     * @folder 客户信息/查询客户信息列表
     */
    @GetMapping("/list")
    public AjaxResult getCustomerInfoList() {
        List<CustomerInfoItemVo> customerInfoList = customerInfoService.getCustomerInfoList();
        return success(customerInfoList);
    }

    /**
     * 编辑客户信息
     *
     * @return
     * @folder 客户信息/编辑客户信息
     */
    @PostMapping("/edit")
    public AjaxResult editCustomerInfo(@RequestBody @Validated List<CustomerInfoBo> boList) {
        return success(customerInfoService.editCustomerInfo(boList));
    }
}
